<?php include "htmlBase/header.php"; ?>

<?php
include_once 'Entidades/EntidadeBase.php';
include_once 'Entidades/PlanoDeAcao.php';
$servicoPlanoDeAcao = new PlanoDeAcao();
$PlanoDeAcao = isset($_GET["Id"]) ? $servicoPlanoDeAcao->ObterPorId($_GET["Id"]) : new PlanoDeAcao();

if ($PlanoDeAcao->Id == 0)
{
    $PlanoDeAcao->id_Responsavel = $_GET["id_Responsavel"];
}

include_once 'Controles/ComboBox.php';
?>

<script>
    
    $(document).ready(
    function () 
    { 
			
        $("input[name = 'DataInicio']").datepicker(
        {
            changeMonth: true,
            changeYear: true
        });
    });

    $(document).ready
    (
    function () 
    { 
        $("input[name = 'Valor']").spinner(
        {
            min: 0,
            max: 999999,
            step: 100,
            start: 0,
            numberFormat: "n"
        });
    }
)
    
    function Validar_Form(form)
    {
<?php
{
    $PlanoDeAcao->getJavaScriptCamposObrigatoriosInput();
}
?>
      
        return true;
    }

</script>


<div class="page">
    <div class="page-header">
        <div class="page-header-content">
            <h1>Plano de Ação <small>(Cadastro)</small></h1>
        </div>
        <div class="progress-bar" align="rigth">
            <div class="bar bg-color-blue" style="width: 75%"></div>
        </div>
    </div>
    <br/>
    <div class="page secondary">
        <div class="page-region">
            <div class="page-region-content">

                <form action="PlanoDeAcaoDados.php" method="POST" onsubmit="return Validar_Form(this)" style="margin-bottom: 100px;">
                    <input type="hidden" class="with-helper" name="Id" value="<?php echo $PlanoDeAcao->Id; ?>"/>
                    <input type="hidden" class="with-helper" name="id_Responsavel" value="<?php echo $PlanoDeAcao->id_Responsavel; ?>"/>

                    <div class="grid">
                        <div class="row">
                            <div class="span4">
                                <div class="input-control text">
                                    <h4>Estratégia de Intervenção</h4>
                                    <input type="text" class="with-helper" placeholder="Estratégia de Intervenção" name="EstrategiaIntervencao" value="<?php echo $PlanoDeAcao->EstrategiaIntervencao; ?>"/>
                                </div>
                            </div>

                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Cras</h4>
                                    <?php ComboBox("PlanoDeAcao.Cras", "Cras", $PlanoDeAcao->Cras); ?>
                                </div>
                            </div>

                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Família</h4>
                                    <?php ComboBox("Familia", "Familia", $PlanoDeAcao->Familia); ?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="span5">
                                <div class="input-control text">
                                    <h4>Rede de Atendimento</h4>
                                    <?php ComboBox("RedeAtendimento", "RedeAtendimento", $PlanoDeAcao->RedeAtendimento); ?>
                                </div>
                            </div>

                            <div class="span5">
                                <div class="input-control text">
                                    <h4>Prazo da Intervenção</h4>
                                    <?php ComboBox("PrazoIntervencao", "PrazoIntervencao", $PlanoDeAcao->PrazoIntervencao); ?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="span5">
                                <div class="input-control text">
                                    <h4>Resultados Esperados</h4>
                                    <input type="text" class="with-helper" placeholder="Resultados Esperados" name="ResultadoEsperado" value="<?php echo $PlanoDeAcao->ResultadoEsperado; ?>"/>
                                </div>
                            </div>

                            <div class="span5">
                                <div class="input-control text">
                                    <h4>Resultados Obtidos</h4>
                                    <input type="text" class="with-helper" placeholder="Resultados Obtidos" name="ResultadoObtidos" value="<?php echo $PlanoDeAcao->ResultadoObtidos; ?>"/>
                                </div>
                            </div>

                        </div>


                    </div>



                    <br/>

                    <div class="input-control" style="width: 60%; margin-left: auto; margin-right: auto;">
                        <input type="hidden" class="with-helper" name="Id" value="<?php echo $PlanoDeAcao->Id; ?>"/>
                        <input type="hidden" class="with-helper" name="id_Responsavel" value="<?php echo $PlanoDeAcao->id_Responsavel; ?>"/>
                    </div>

                    <br/>

                    <div class="input-control" style="margin-left: auto; margin-right: auto;">
                        <button class="standart default" type="submit">Salvar</button>
                        <a href="PlanoDeAcaoCadastro.php?id_Responsavel=<?php echo $PlanoDeAcao->id_Responsavel; ?>" class="button standart">Novo</a>
                        <?php
                        if ($PlanoDeAcao->Id != 0)
                        {
                            ?>
                            <a href="PlanoDeAcaoCadastro.php?Id=<?php echo $PlanoDeAcao->Id; ?>" class="button standart">Cancelar</a>
                            <?php
                        }
                        ?>

                        <a href="PlanoDeAcaoPesquisa.php?id_Responsavel=<?php echo $PlanoDeAcao->id_Responsavel; ?>" class="button standart bg-color-lighten" style="float: right">Lista</a>
                    </div>

                </form>
            </div>
        </div>
    </div>

</div>

<?php include "htmlBase/footer.php"; ?>
